/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.niedziela12.pai.ejb.dto;

import com.niedziela12.pai.ejb.entities.UserRoles;

/**
 *
 * @author Kamil
 */
public class UserRolesDTO {
    private Integer id;    
    private int version;
    private boolean active;
    private UserDTO idLogin;
    private RoleDTO idRole;
    
    public UserRolesDTO(){        
    }
    
    public UserRolesDTO(UserRoles ur){
        id = ur.getId();
        version = ur.getVersion();
        active = ur.getActive();
        idLogin = new UserDTO(ur.getIdLogin());
        idRole = new RoleDTO(ur.getIdRole());
    }

    public UserRoles toUserRoles(){
        UserRoles ur = new UserRoles();
        ur.setId(id);
        ur.setActive(active);
        ur.setIdLogin(idLogin.toUser());
        ur.setIdRole(idRole.toRole());
        ur.setVersion(version);
        return ur;
    }
    
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public UserDTO getIdLogin() {
        return idLogin;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public void setIdLogin(UserDTO idLogin) {
        this.idLogin = idLogin;
    }

    public RoleDTO getIdRole() {
        return idRole;
    }

    public void setIdRole(RoleDTO idRole) {
        this.idRole = idRole;
    }

    @Override
    public String toString() {
        return "UserRolesDTO{" + "id=" + id + ", active=" + active + ", idLogin=" + idLogin + ", idRole=" + idRole + '}';
    }
    
    
}
